Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
svg.js is a lightweight library for manipulating and animating SVG (Scalable Vector Graphics) elements. It provides a simple and intuitive API for creating, modifying, and animating SVG elements, making it easier to work with SVGs in web applications.
Creating SVG Elements
This feature allows you to create SVG elements such as rectangles, circles, and lines. The code sample demonstrates how to create an SVG canvas and add a rectangle to it.
const draw = SVG().addTo('body').size(300, 300);
const rect = draw.rect(100, 100).attr({ fill: '#f06' });
Animating SVG Elements
This feature enables you to animate SVG elements. The code sample shows how to animate the fill color of a rectangle over a duration of 1000 milliseconds.
rect.animate(1000, '<>').attr({ fill: '#0f9' });
Transformations
This feature allows you to apply transformations such as moving, rotating, and scaling to SVG elements. The code sample demonstrates how to move, rotate, and scale a rectangle.
rect.move(50, 50).rotate(45).scale(1.5);
Event Handling
This feature lets you attach event handlers to SVG elements. The code sample shows how to change the fill color of a rectangle when it is clicked.
rect.on('click', function() { this.fill({ color: '#f93' }); });
D3.js is a powerful library for creating data-driven documents using HTML, SVG, and CSS. It provides extensive capabilities for data visualization and manipulation, making it more complex but also more versatile compared to svg.js.
Two.js is a lightweight 2D drawing library for modern web browsers. It supports SVG, Canvas, and WebGL renderers. Compared to svg.js, Two.js offers a broader range of rendering options but may be less specialized in SVG manipulation.
A lightweight library for manipulating and animating SVG, without any dependencies.
SVG.js is licensed under the terms of the MIT License.
npm install svg.js
yarn add svg.js
bower install svg.js
https://cdnjs.com/libraries/svg.js
Check https://svgjs.com/ to learn more.
[2.7.1] - 2018-11-30
FAQs
A lightweight library for manipulating and animating SVG.
The npm package svg.js receives a total of 511,459 weekly downloads. As such, svg.js popularity was classified as popular.
We found that svg.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.